home *** CD-ROM | disk | FTP | other *** search
/ Tech Arsenal 1 / Tech Arsenal (Arsenal Computer).ISO / tek-01 / begincpp.zip / #5_VER2.C < prev    next >
C/C++ Source or Header  |  1990-08-05  |  9KB  |  291 lines

  1. #line 1 "#5_VER2.cxx"
  2. void *_new(long);
  3. void _delete(void*);
  4. void *_vec_new(void*,int,int,void*(*)(void*));
  5. void _vec_delete(void*,int,int,void(*)(void*,int),...);
  6. void exit(int);
  7. static void cdecl _STI();
  8. static void cdecl _STD();
  9.  
  10. typedef unsigned int size_t ;
  11. typedef char *va_list ;
  12. struct _iobuf { 
  13. char *__iobuf__ptr ;
  14. int __iobuf__cnt ;
  15. char *__iobuf__base ;
  16. char __iobuf__flag ;
  17. char __iobuf__file ;} ;
  18. extern struct _iobuf _iob [];
  19. int _filbuf (struct _iobuf *);
  20. int _flsbuf (int , struct _iobuf *);
  21. void clearerr (struct _iobuf *);
  22. int fclose (struct _iobuf *);
  23. int fcloseall (void );
  24. struct _iobuf *fdopen (int , char *);
  25. int fflush (struct _iobuf *);
  26. int fgetc (struct _iobuf *);
  27. int fgetchar (void );
  28. int fgetpos (struct _iobuf *, long *);
  29. char *fgets (char *, int , struct _iobuf *);
  30. int flushall (void );
  31. struct _iobuf *fopen (char *, char *);
  32. int fprintf (struct _iobuf *, char *, ... );
  33. int fputc (int , struct _iobuf *);
  34. int fputchar (int );
  35. int fputs (char *, struct _iobuf *);
  36. size_t fread (void *, size_t , size_t , struct _iobuf *);
  37. struct _iobuf *freopen (char *, char *, struct _iobuf *);
  38. int fscanf (struct _iobuf *, char *, ... );
  39. int fsetpos (struct _iobuf *, long *);
  40. int fseek (struct _iobuf *, long , int );
  41. long ftell (struct _iobuf *);
  42. size_t fwrite (void *, size_t , size_t , struct _iobuf *);
  43. char *gets (char *);
  44. int getw (struct _iobuf *);
  45. void perror (char *);
  46. int printf (char *, ... );
  47. int puts (char *);
  48. int putw (int , struct _iobuf *);
  49. int remove (char *);
  50. int rename (char *, char *);
  51. void rewind (struct _iobuf *);
  52. int rmtmp (void );
  53. int scanf (char *, ... );
  54. void setbuf (struct _iobuf *, char *);
  55. int setvbuf (struct _iobuf *, char *, int , size_t );
  56. int sprintf (char *, char *, ... );
  57. int sscanf (char *, char *, ... );
  58. char *tempnam (char *, char *);
  59. struct _iobuf *tmpfile (void );
  60. char *tmpnam (char *);
  61. int ungetc (int , struct _iobuf *);
  62. int unlink (char *);
  63. int vfprintf (struct _iobuf *, char *, va_list );
  64. int vprintf (char *, va_list );
  65. int vsprintf (char *, char *, va_list );
  66.  
  67.  
  68. struct animal { 
  69.     int (pascal **_animal__vptr_PN )(void );
  70. } ;
  71. static void pascal _animal_identify (struct animal* );
  72. static int (pascal *animal__vtbl_PN[])() = {
  73.     (int(pascal *)()) _animal_identify , 
  74.     (int(pascal *)()) 0
  75. };
  76.  
  77. struct mammal { 
  78.     int (pascal **_animal__vptr_PN )(void );
  79. } ;
  80. static void pascal _mammal_identify (struct mammal* );
  81. static int (pascal *mammal__vtbl_PN[])() = {
  82.     (int(pascal *)()) _mammal_identify , 
  83.     (int(pascal *)()) 0
  84. };
  85.  
  86. struct bird { 
  87.     int (pascal **_animal__vptr_PN )(void );
  88. } ;
  89. static void pascal _bird_identify (struct bird* );
  90. static int (pascal *bird__vtbl_PN[])() = {
  91.     (int(pascal *)()) _bird_identify , 
  92.     (int(pascal *)()) 0
  93. };
  94.  
  95. struct dog { 
  96.     int (pascal **_animal__vptr_PN )(void );
  97. } ;
  98. static void pascal _dog_identify (struct dog* );
  99. static int (pascal *dog__vtbl_PN[])() = {
  100.     (int(pascal *)()) _dog_identify , 
  101.     (int(pascal *)()) 0
  102. };
  103.  
  104. struct eagle { 
  105.     int (pascal **_animal__vptr_PN )(void );
  106. } ;
  107. static void pascal _eagle_identify (struct eagle* );
  108. static int (pascal *eagle__vtbl_PN[])() = {
  109.     (int(pascal *)()) _eagle_identify , 
  110.     (int(pascal *)()) 0
  111. };
  112.  
  113. void print1 (void );
  114. void print2 (void );
  115. void print3 (void );
  116.  
  117. int main ()
  118.     { 
  119.         print1 ( ) ;
  120.         print2 ( ) ;
  121.         print3 ( ) ;
  122.     }  
  123.     exit ( 0 ); 
  124. }
  125.  
  126. extern void print1 ()
  127.     struct animal *_au1_ap = 0 ;
  128.     struct mammal *_au1_mp = 0 ;
  129.     struct bird *_au1_bp = 0 ;
  130.     struct dog *_au1_dp = 0 ;
  131.     struct eagle *_au1_ep = 0 ;
  132.     register struct mammal *_au0__Xthis__ctor_mammal = 0 ;
  133.     register struct bird *_au0__Xthis__ctor_bird = 0 ;
  134.     register struct dog *_au0__Xthis__ctor_dog = 0 ;
  135.     register struct eagle *_au0__Xthis__ctor_eagle = 0 ;
  136.     register struct animal *_au0__Xthis__ctor_animal = 0 ;
  137.  
  138.     _au1_ap = (struct animal *)( (_au0__Xthis__ctor_animal = 0 ), 
  139.         ( ( (_au0__Xthis__ctor_animal = (struct animal *)_new ( 
  140.             (long )(sizeof (struct animal))) ), 0 ) , 
  141.             ( (_au0__Xthis__ctor_animal -> _animal__vptr_PN 
  142.             =  animal__vtbl_PN), ((_au0__Xthis__ctor_animal ))) ) ) ;
  143.             
  144.     (*(((void (pascal *)())(*_au1_ap -> _animal__vptr_PN ))))( _au1_ap ) ;
  145.  
  146.     _au1_mp = (struct mammal *)( (_au0__Xthis__ctor_mammal = 0 ), 
  147.         ( ( (_au0__Xthis__ctor_mammal = (struct mammal *)_new ( 
  148.             (long )(sizeof (struct mammal))) ), 0 ) , 
  149.             ( ( (_au0__Xthis__ctor_mammal 
  150.             = (struct mammal *)( ( ((((struct animal *)
  151.             _au0__Xthis__ctor_mammal ))-> _animal__vptr_PN 
  152.             =  animal__vtbl_PN), 
  153.             (((((struct animal *)_au0__Xthis__ctor_mammal ))))) ) ), 
  154.             (_au0__Xthis__ctor_mammal -> _animal__vptr_PN 
  155.             =  mammal__vtbl_PN)) , ((_au0__Xthis__ctor_mammal ))) ) ) ;
  156.     
  157.     (*(((void (pascal *)())(*_au1_mp -> _animal__vptr_PN ))))( _au1_mp ) ;
  158.  
  159.     _au1_bp = (struct bird *)( (_au0__Xthis__ctor_bird = 0 ), 
  160.         ( ( (_au0__Xthis__ctor_bird = (struct bird *)_new ( 
  161.             (long )(sizeof (struct bird))) ), 0 ) , 
  162.             ( ( (_au0__Xthis__ctor_bird = (struct bird *)
  163.             ( ( ((((struct animal *)_au0__Xthis__ctor_bird ))-> 
  164.             _animal__vptr_PN =  animal__vtbl_PN), 
  165.             (((((struct animal *)_au0__Xthis__ctor_bird ))))) ) ), 
  166.             (_au0__Xthis__ctor_bird -> _animal__vptr_PN 
  167.             =  bird__vtbl_PN)) , ((_au0__Xthis__ctor_bird ))) ) ) ;
  168.             
  169.     (*(((void (pascal *)())(*_au1_bp -> _animal__vptr_PN ))))( _au1_bp ) ;
  170.  
  171.     _au1_dp = (struct dog *)( (_au0__Xthis__ctor_dog = 0 ), 
  172.         ( ( (_au0__Xthis__ctor_dog = (struct dog *)_new ( 
  173.             (long )(sizeof (struct dog))) ), 0 ) , 
  174.             ( ( (_au0__Xthis__ctor_dog = (struct dog *)
  175.             ( ( ( (( ( ((((struct animal *)(((struct mammal *)
  176.             _au0__Xthis__ctor_dog ))))-> _animal__vptr_PN 
  177.             =  animal__vtbl_PN), 
  178.             (((((struct animal *)(((struct mammal *)
  179.             _au0__Xthis__ctor_dog ))))))) ) ), 
  180.             ((((struct mammal *)_au0__Xthis__ctor_dog ))-> _animal__vptr_PN 
  181.             =  mammal__vtbl_PN)) , 
  182.             (((((struct mammal *)_au0__Xthis__ctor_dog ))))) ) ), 
  183.             (_au0__Xthis__ctor_dog -> _animal__vptr_PN 
  184.             =  dog__vtbl_PN)) , ((_au0__Xthis__ctor_dog ))) ) ) ;
  185.             
  186.     (*(((void (pascal *)())(*_au1_dp -> _animal__vptr_PN ))))( _au1_dp ) ;
  187.  
  188.     _au1_ep = (struct eagle *)( (_au0__Xthis__ctor_eagle = 0 ), 
  189.         ( ( (_au0__Xthis__ctor_eagle = (struct eagle *)_new ( 
  190.         (long )(sizeof (struct eagle))) ), 0 ) , 
  191.         ( ( (_au0__Xthis__ctor_eagle = (struct eagle *)
  192.         ( ( ( (( ( ((((struct animal *)(((struct bird *)
  193.         _au0__Xthis__ctor_eagle ))))-> _animal__vptr_PN 
  194.         =  animal__vtbl_PN), (((((struct animal *)
  195.         (((struct bird *)_au0__Xthis__ctor_eagle ))))))) ) ), 
  196.         ((((struct bird *)_au0__Xthis__ctor_eagle ))-> _animal__vptr_PN 
  197.         =  bird__vtbl_PN)) , 
  198.         (((((struct bird *)_au0__Xthis__ctor_eagle ))))) ) ), 
  199.         (_au0__Xthis__ctor_eagle -> _animal__vptr_PN =  eagle__vtbl_PN)) , 
  200.         ((_au0__Xthis__ctor_eagle ))) ) ) ;
  201.         
  202.     (*(((void (pascal *)())(*_au1_ep -> _animal__vptr_PN ))))( _au1_ep ) ;
  203.  
  204.     printf ( (char *)"\n") ;
  205.  
  206. extern void print2 ()
  207.     struct animal *_au1_ap = 0 ;
  208.     struct mammal *_au1_mp = 0 ;
  209.     struct mammal *_au0__K1 = 0 ;
  210.     
  211.     register struct animal *_au0__Xthis__ctor_animal = 0 ;
  212.     
  213.     _au1_ap = (struct animal *)( (_au0__Xthis__ctor_animal = 0 ), 
  214.         ( ( (_au0__Xthis__ctor_animal = (struct animal *)_new ( 
  215.             (long )(sizeof (struct animal))) ), 0 ) , 
  216.             ( (_au0__Xthis__ctor_animal -> _animal__vptr_PN 
  217.             =  animal__vtbl_PN), ((_au0__Xthis__ctor_animal ))) ) ) ;
  218.  
  219.     (*(((void (pascal *)())(*_au1_ap -> _animal__vptr_PN ))))( _au1_ap ) ;
  220.  
  221.     ( (_au0__K1 = (((struct mammal *)_au1_ap ))), (*(((void (pascal *)())
  222.         (*_au0__K1 -> _animal__vptr_PN ))))( _au0__K1 ) ) ;
  223.  
  224.     _au1_mp = (((struct mammal *)_au1_ap ));
  225.     (*(((void (pascal *)())(*_au1_mp -> _animal__vptr_PN ))))( _au1_mp ) ;
  226.  
  227.     printf ( (char *)"\n") ;} 
  228.  
  229. extern void print3 ()
  230.     struct animal _au1_a ;
  231.     struct animal *_au1_ap = 0 ;
  232.     struct mammal _au1_m ;
  233.     struct eagle _au1_e ;
  234.  
  235.     ( ( ((& _au1_a )-> _animal__vptr_PN =  animal__vtbl_PN), 
  236.             (((& _au1_a )))) ) ;
  237.     
  238.     _au1_ap = (& _au1_a );
  239.  
  240.     ( ( ( (( ( ((((struct animal *)(& _au1_m )))-> _animal__vptr_PN 
  241.         =  animal__vtbl_PN), (((((struct animal *)(& _au1_m )))))) ) ), 
  242.         ((& _au1_m )-> _animal__vptr_PN =  mammal__vtbl_PN)) , 
  243.         (((& _au1_m )))) ) ;
  244.  
  245.     ( ( ( (( ( ( (( ( ((((struct animal *)
  246.         (((struct bird *)(& _au1_e )))))-> _animal__vptr_PN 
  247.         =  animal__vtbl_PN), 
  248.         (((((struct animal *)(((struct bird *)(& _au1_e )))))))) ) ), 
  249.         ((((struct bird *)(& _au1_e )))-> _animal__vptr_PN 
  250.         =  bird__vtbl_PN)) , (((((struct bird *)(& _au1_e )))))) ) ), 
  251.         ((& _au1_e )-> _animal__vptr_PN =  eagle__vtbl_PN)) , 
  252.         (((& _au1_e )))) ) ;
  253.  
  254.     (*(((void (pascal *)())(*_au1_ap -> _animal__vptr_PN ))))( _au1_ap ) ;
  255.  
  256.     _au1_ap = (struct animal *)(& _au1_m );
  257.     
  258.     (*(((void (pascal *)())(*_au1_ap -> _animal__vptr_PN ))))( _au1_ap ) ;
  259.  
  260.     printf ( (char *)"\n") ;} 
  261.  
  262. static void pascal _eagle_identify (register struct eagle *this )
  263.     printf ( (char *)"%s\n", "eagle") ;
  264.  
  265. static void pascal _dog_identify (register struct dog *this )
  266.     printf ( (char *)"%s\n", "dog") ;
  267.  
  268. static void pascal _bird_identify (register struct bird *this )
  269.     printf ( (char *)"%s\n", "bird") ;
  270.  
  271. static void pascal _mammal_identify (register struct mammal *this )
  272.     printf ( (char *)"%s\n", "mammal") ;
  273.  
  274. static void pascal _animal_identify (register struct animal *this )
  275.     printf ( (char *)"%s\n", "animal") ;
  276.